Problems with: "for object attributes in module"

Trying to use the defined construct "for object attributes in module".

I call a function that uses this construct: the function takes a module handle "m".

The function is called twice with two different module handles, but the second time through the function I am seeing the construct find attributes that only exist in the first module!

 

I can reproduce the problem with the below code...any ideas what the issue is??

 

Module m,m1,m2
string attrName
m1=read("Module1",false)
m2=read("Module2",false)
if (null m1 || null m2) {print "OOPS!\n";halt}

m=m1
for attrName in m do
{
        print attrName "\n"
}

print "******************************************************\n"

m=m2
for attrName in m do
{
        print attrName "\n"
}

 


strathglass - Wed Mar 29 23:22:45 EDT 2017

Re: Problems with: "for object attributes in module"
PekkaMakinen - Thu Mar 30 01:03:58 EDT 2017

Tested your script in our environment with DOORS 9.6.0.3 - could not replicate the problem.

 

BTW, your example was the first time I noticed that you can iterate over the (string) object attribute names in module. If you have problems with that, try to iterate over the AttrDef's:

 

AttrDef ad = null

Module m = current

for ad in m do

{

   if (!ad.object) continue

   else print ad.name "\n"

}

Re: Problems with: "for object attributes in module"
Mathias Mamsch - Thu Mar 30 03:52:23 EDT 2017

There is really nothing I can think of that could be going wrong with this script. I don't like to say it, but is it possible that you are experiencing a case of "human error"? Either that, or the "for string in Module" loop is fudged. Regards, Mathias

Re: Problems with: "for object attributes in module"
strathglass - Thu Mar 30 10:25:14 EDT 2017

Thanks Pekka / Mathias

Investigated further  and yes...it was human error. :(

We've got lots of identically named modules in different projects: I was looking at the attribute details for a pair of modules in one project, but was running the script on a pair in a DIFFERENT project.

Oops.